<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body style="height: 1000px;width: 2000px;">
		<div id="box1">
			
		</div>
	</body>
</html>
<script type="text/javascript">
	// 使div跟随鼠标移动
	document.onmousemove = function(e){
		// clientX和clientY获取鼠标当前可见窗口坐标
		// pageX和pageY获取鼠标相对于当前页面的坐标
		// console.log(document.documentElement.scrollTop)
		var left = e.pageX;
		var top = e.pageY;
		// 设置div偏移量
		box1.style.left = left+"px";
		box1.style.top = top+"px";
	}
</script>
<style type="text/css">
	#box1{
		width: 3.125rem;
		height: 3.125rem;
		border-radius: 1.5625rem;
		background-color:red ;
		position: absolute;
	}
</style>